class Solution:
    def increasingTriplet(self, nums) -> bool:
        if len(nums) <= 2:
            return False
        minNum = [nums[0]] * len(nums)
        maxNum = [nums[-1]] * len(nums)
        for i in range(1, len(nums)):
            minNum[i] = min(minNum[i-1], nums[i])
        for i in range(len(nums)-2, -1, -1):
            maxNum[i] = max(maxNum[i+1], nums[i])
        for i in range(1, len(nums)-1):
            if minNum[i-1]<nums[i]<maxNum[i+1]:
                return True
        return False



if __name__ == '__main__':
    so = Solution()
    num = [1,2,3,4,5,2]
    r = so.increasingTriplet(num)
    print(r)
